{% extends 'admin/category.html' %}
{% block member %}
<div class="is-block">
    <div class=" is-pulled-left">
        <h1 class=" is-size-4">
            <span class="icon">
                <i class="mdi mdi-receipt-outline"></i>
            </span>
            Admin User
        </h1>
    </div>
</div>
{% block button %} {% endblock button %}
<div class="is-clearfix"></div>
<div class=" dropdown-divider"></div>

{% block table_content %}
    <form action="" method="post" class="mt-4" enctype="multipart/form-data">
        {{ form.csrf_token }}
        <div class="field">
            {{ form.username.label(class='label') }}
            <div class="control">
                {{ form.username(class='input', placeholder='username') }}
            </div>
        </div>
        <div class="field">
            {{ form.email.label(class='label') }}
            <div class="control">
                <!-- 邮箱 -->
                {{ form.email(class='input', placeholder='email') }}
{#                <span class="icon is-small is-left">#}
{#                    <i class="fas fa-envelope"></i>#}
{#                </span>#}
{#                {% if form.email.errors %}#}
{#                    <span class="icon is-small is-right has-text-danger">#}
{#                        <i class="fas fa-exclamation-triangle"></i>#}
{#                    </span>#}
{#                {% else %}#}
{#                    <span class="icon is-small is-right">#}
{#                        <i class="fas fa-check"></i>#}
{#                    </span>#}
{#                {% endif %}#}
            </div>
{#            <!-- 显示邮箱字段的错误消息 -->#}
{#            {% for error in form.email.errors %}#}
{#                <p class="help is-danger">{{ error }}</p>#}
{#            {% endfor %}#}
        </div>
        <div class="field">
            {{ form.password.label(class='label') }}
            <div class="control">
                {{ form.password(class='input', placeholder='password') }}
                <p class="help has-text-grey-light">
                    {{ form.password.description }}
                </p>
            </div>
        </div>
        <div class="field">
            {{ form.avatar.label(class='label') }}
            <div class="control">
                {{ form.avatar(class='input',  placeholder='avatar') }}
                <p class="help has-text-grey-light">
                    {{ form.avatar.description }}
                </p>
            </div>
            
        </div>

        <div class="field">
            <label class="checkbox">
                {{ form.is_super_user }}
                {{ form.is_super_user.label }}
            </label>
        </div>
        <div class="field">
            <label class="checkbox">
                {{ form.is_active }}
                {{ form.is_active.label }}
            </label>
        </div>
        <div class="field">
            <label class="checkbox">
                {{ form.is_staff }}
                {{ form.is_staff.label }}
            </label>
        </div>
        <div class="is-block">
            <div class="box has-background-light is-shadowless level">
                <button class=" is-danger button level-left">delete</button>
                <div class="level-right">
                    <a href="{{ url_for('admin.user') }}" class="button is-primary is-light mr-2">back</a>
                    <input type="submit" value="save" class=" button is-success">
                </div>
            </div>
        </div>
    </form>
{% endblock table_content %} 
{% endblock member %}